<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	template="/templates/prime.xhtml">

	<ui:define name="content">
		<h:form id="form" prependId="false">
			<p:growl id="growl" showDetail="true"/> 
			<p:dataTable id="mediaTable" var="media" value="#{mediaBean.items}" rows="10" paginator="true">
				<f:facet name="header">  
            		Media Viewer
        		</f:facet> 
        		
				<p:column filterBy="#{media.releaseId}" sortBy="#{media.releaseId}" style="width:20px">  
					<f:facet name="header">
						<h:outputText value="ReleaseID" />
					</f:facet>
					<h:outputText value="#{media.releaseId}"></h:outputText>
				</p:column>

				<p:column filterBy="#{media.title}" sortBy="#{media.title}" style="width:150px">  
					<f:facet name="header">
						<h:outputText value="Title" />
					</f:facet>
					<h:outputText value="#{media.title}"></h:outputText>
				</p:column>

				<p:column filterBy="#{media.id}" sortBy="#{media.id}" style="width:20px">  
					<f:facet name="header">
						<h:outputText value="MediaID" />
					</f:facet>
					<h:outputText value="#{media.id}"></h:outputText>
				</p:column>
				
				<p:column filterBy="#{media.mobileId}" sortBy="#{media.mobileId}" style="width:20px">  
					<f:facet name="header">
						<h:outputText value="MobileID" />
					</f:facet>
					<h:outputText value="#{media.mobileId}"></h:outputText>
				</p:column>
				
				<p:column sortBy="#{media.availableInMobile}" style="width:20px">  
					<f:facet name="header">
						<h:outputText styleClass="ui-icon ui-icon-flag"/>
					</f:facet>
					<p:selectBooleanCheckbox value="#{media.availableInMobile}" disabled="true"/>
				</p:column>		
																				
        		<p:column style="width:5px">
        		 	<p:commandLink  async="true" oncomplete="deleteDlg.show()" styleClass="ui-icon ui-icon-trash">
		            	<f:setPropertyActionListener value="#{media}" target="#{mediaBean.selected}" />
	            	</p:commandLink>
	            </p:column>	 
			</p:dataTable>		

            <p:confirmDialog widgetVar="deleteDlg" id="deleteDialog" header="Delete" message="MSB should do this for you, are you sure?"
                               width="400" showEffect="fade" hideEffect="fade" modal="true" closable="false" severity="alert" dynamic="true">
                  <h:panelGroup layout="block" style="text-align: right">
                      <p:commandButton value="Yes" actionListener="#{mediaBean.delete}" oncomplete="deleteDlg.hide()" update="mediaTable, growl" />
                      <p:commandButton value="No" actionListener="#{mediaBean.cancel}" oncomplete="deleteDlg.hide()" update="growl"/>
                  </h:panelGroup>
            </p:confirmDialog>
        </h:form>
	</ui:define>
</ui:composition>